<include file="public@header"/>
</head>
<body>
<div class="wrap">
	<ul class="nav nav-tabs">
		<li><a href="{:url('student/index')}">学生列表</a></li>
		<li class="active"><a>学生班级</a></li>
	</ul>
	<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('student/editPost')}">
		<div class="form-group">
			<label for="name" class="col-sm-2 control-label">头像<span class="form-required">*</span></label>
			<input id="photo-1" type="hidden" name="image" value="{$student.image}">
			<input id="photo-1-name" type="text" name="photo_name" title="图片名称">
			<img id="photo-1-preview" width="50px" height="50px" src="/upload/{$student.image}">
			<a href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a>
		</div>
		<div class="form-group">
			<label for="name" class="col-sm-2 control-label">姓名<span class="form-required">*</span></label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="name" name="name" value="{$student.name}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">性别<span class="form-required">*</span></label>
			<div class="col-md-6 col-sm-10">
				<if $student.sex == '男'>
				<input type="radio"  name="sex" value="1" checked >男
				<input type="radio" name="sex" value="2">女
				<else>
					<input type="radio"  name="sex" value="1">男
					<input type="radio" name="sex" value="2" checked>女
				</else>
				</if>
			</div>
		</div>
		<div class="form-group">
			<label for="idcard" class="col-sm-2 control-label">身份证号<span class="form-required">*</span></label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="idcard" name="idcard" value="{$student.idcard}">
			</div>
		</div>
		<div class="form-group">
			<label for="address" class="col-sm-2 control-label">家庭住址<span class="form-required">*</span></label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="address" name="address" value="{$student.address}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">所属学校<span class="form-required">*</span></label>
			<div class="col-md-6 col-sm-10" >
				<select class="form-control" name="" id="selectSchool">
					<foreach name="school" item="vo">
						<if $school_id == $vo.id>
							<option value="{$vo.id}" selected>{$vo.name}</option>
							<else>
								<option value="{$vo.id}">{$vo.name}</option>
							</else>
						</if>
					</foreach>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">所属班级<span class="form-required">*</span></label>
			<div class="col-md-6 col-sm-10" >
				<select name="room_id" id="room" class="form-control">
					<option value="">|--请选择班级--|</option>
					<foreach name="room" item="vo">
						<if $student.room_id == $vo.id>
							<option value="{$vo.id}" selected>{$vo.name}</option>
							<else>
								<option value="{$vo.id}">{$vo.name}</option>
							</else>
						</if>
					</foreach>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">是否在籍<span class="form-required">*</span></label>
			<div class="col-md-6 col-sm-10" >
				<select name="status" id="status" class="form-control">
					<if $student.status == '否'>
					<option value="1" selected>否</option>
					<option value="2">是</option>
					<else>
						<option value="1">否</option>
						<option value="2" selected>是</option>
					</else>
					</if>
				</select>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<input type="hidden" name="id" value="{$student.id}">
				<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
				<a class="btn btn-default" href="{:url('student/index')}">{:lang('BACK')}</a>
			</div>
		</div>
	</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $(function () {
        $('#selectSchool').change('click',function () {
            var schoolId=$('#selectSchool').val();
            $.ajax({
                url:"{:url('student/getRoomBySchool')}",
                type:"POST",
                data:{school_id:schoolId},
                success:function (res) {
                    console.log(res);
                    $('#room').html(res);
                }
            })
        })
    })
</script>
</body>
</html>